package com.mrjy.coursepackage.controller;

import com.mrjy.common.entity.UserCoursePackageRel;
import com.mrjy.coursepackage.bo.IUserCoursePackageBo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.mail.Session;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/coursepackage/userCoursePackage")
public class UserCoursePackageController {
	
	@Resource
	private IUserCoursePackageBo userCoursePackageBo;
	
	/**
	 * 更新浏览记录,没有则添加
	 * @param rel
	 * @return
	 */
	@RequestMapping("/queryByUserIdAndCoursePackageId")
	@ResponseBody
	public Object queryByUserIdAndCoursePackageId(UserCoursePackageRel rel) {
		return userCoursePackageBo.queryByUserIdAndCoursePackageId(rel);
	}
	
	
	/**
     * 查询用户是否有点击(浏览)过课程包
     * @param userId
     * @return
     */
    @RequestMapping("/hasClickHistory")
    @ResponseBody
    public Object hasClickHistory(Integer userId) {
        return userCoursePackageBo.hasClickHistory(userId);
    }

    /**
     * 分类同学-- 排名
     *
     * @param userId
     * @return
     */
    @RequestMapping("/queryClassmate")
    @ResponseBody
    public Object queryClassmate(UserCoursePackageRel rel, HttpSession session) {
        return userCoursePackageBo.queryClassmate(rel, session);
    }

}
